package com.leetcode.weekly.contest.no283th;

import java.util.List;

/**
 * @author 覃国强
 * @date 2022-03-06 11:49
 */
public class A04_替换数组中的非互质数 {

  public static void main(String[] args) {
    Solution solution = new Solution();
    int gcd = solution.gcd(8, 12);
    int gcd2 = solution.gcd2(8, 12);
    System.out.println(gcd2);
    System.out.println(gcd);
  }


  static
  class Solution {
    public List<Integer> replaceNonCoprimes(int[] nums) {
      return null;
    }

    private int gcd(int a, int b) {
      int c = a % b;
      while (c != 0) {
        a = b;
        b = c;
        c = a % b;
      }
      return b;
    }

    private int gcd2(int a, int b) {
      return b == 0 ? a : gcd2(b, a % b);
    }


    private int lcm(int a, int b) {
      int gcd = gcd(a, b);
      return a * b / gcd;
    }
  }

}
